package com.example.mp3play;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.LinkedList;

public class musicAdapter extends BaseAdapter {
    private LinkedList<Music> mDate;
    private Context mContext;
    private int selectItem = -1;
    public musicAdapter(LinkedList<Music> mData, Context mContext) {
        this.mDate = mData;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return mDate.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.song,parent,false);
        TextView name = (TextView) convertView.findViewById(R.id.s_name);
        name.setText(mDate.get(position).getName());
        return convertView;
    }

    public int getSelectItem() {
        return selectItem;
    }

    public void setSelectItem(int selectItem) {
        this.selectItem = selectItem;
    }

}
